package com.lzw.cpvideoplayer.ulit;


import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.VideoView;

import com.lzw.cpvideoplayer.data.TimeLine;
import com.lzw.cpvideoplayer.mvp.view.LoadDiaLog;

import androidx.annotation.NonNull;

public class MyHolder extends Handler {
    private SeekBar seek;
    private VideoView vd;
    private TextView mTimetext;
    private TextView mTimetextMax;
    private static final String TAG = "MyHolder";
    @Override
    public void handleMessage(@NonNull Message msg) {
        super.handleMessage(msg);

            if(msg.what == 1){
                seek.setProgress(msg.arg1);
                TimeLine time = (TimeLine) msg.obj;
                // time.setS(position/1000%60);
                //                    time.setM(position/1000/60%60);
                //                    time.setH(position/1000/60/60%60);

                int s = time.getMaxTime()/1000%60;
                int m = time.getMaxTime()/1000/60%60;
                int h = time.getMaxTime()/1000/60/60%60;
                mTimetextMax.setText(h+":"+m+":"+s);
                mTimetext.setText(time.getH()+":"+ time.getM()+":"+ time.getS());
                //       Log.e(TAG, "handleMessage: "+msg.arg1+"--"+msg.arg2 );
            }else if(msg.what == 2){
                LoadDiaLog.getInstance((Context) msg.obj).show();
            }else if(msg.what == 3){
                LoadDiaLog.getInstance((Context) msg.obj).onLoadDismiss();
            }


    }
    public MyHolder(SeekBar seek, VideoView vd, TextView timeLine, TextView timeLineMax){
        this.seek = seek;
        this.vd = vd;
        mTimetext = timeLine;
        mTimetextMax = timeLineMax;
    }
}
